package com.ecoolex.hotel.saas.ws;

import java.math.BigDecimal;
import java.util.List;

import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import com.ecoolex.framework.common.exception.BizException;
import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.hotel.saas.core.manager.PresaleCouponDistribtionManager;
import com.ecoolex.hotel.saas.core.manager.PresaleCouponExpirydateManager;
import com.ecoolex.hotel.saas.core.manager.PresaleCouponManager;
import com.ecoolex.hotel.saas.entity.PresaleCoupon;
import com.ecoolex.hotel.saas.entity.PresaleCouponDistribtion;
import com.ecoolex.hotel.saas.entity.PresaleCouponExpirydate;
import com.ecoolex.hotel.saas.pojo.EditPresaleCouponStep;

@Service
public class PresaleCouponServiceImpl implements PresaleCouponService{
	
	@Autowired
	private PresaleCouponManager presaleCouponManager;

	@Override
	public PresaleCoupon getPresaleCoupon(Integer preCouponId) {
		return presaleCouponManager.getPresaleCoupon(preCouponId);
	}

	@Override
	public Pagination<PresaleCoupon> queryPresaleCoupon(String name,Integer storeId, Page page) {
		return presaleCouponManager.queryPresaleCoupon(name,storeId, page);
	}

	@Override
	public PresaleCoupon editPresaleCoupon(EditPresaleCouponStep step, String createUser) throws BizException {
		return presaleCouponManager.editPresaleCoupon(step, createUser);
	}

	@Override
	public PresaleCoupon onlinePresaleCoupon(PresaleCoupon record, String updateUser) throws BizException {
		return presaleCouponManager.onlinePresaleCoupon(record, updateUser);
	}

	@Override
	public PresaleCoupon offlinePresaleCoupon(PresaleCoupon record, String updateUser) throws BizException {
		return presaleCouponManager.offlinePresaleCoupon(record, updateUser);
	}

	@Override
	public Boolean delPresaleCoupon(PresaleCoupon record, String updateUser) throws BizException {
		return presaleCouponManager.delPresaleCoupon(record, updateUser);
	}

	@Override
	public PresaleCoupon getPresaleCouponForUser(Integer preCouponId) {
		return presaleCouponManager.getPresaleCouponForUser(preCouponId);
	}

	@Override
	public Pagination<PresaleCoupon> queryPresaleCouponForUser(String name, Integer storeId, Integer categoryId, Page page) {
		return presaleCouponManager.queryPresaleCouponForUser(name, storeId, categoryId, page);
	}

	@Override
	public BigDecimal salesUserCommissionAmt(Integer preCouponId, Integer storeId, Integer userId) {
		return presaleCouponManager.salesUserCommissionAmt(preCouponId, storeId, userId);
	}
	
	@Autowired
	private PresaleCouponDistribtionManager presaleCouponDistribtionManager;

	@Override
	public List<PresaleCouponDistribtion> queryByPreCouponId(Integer preCouponId) {
		return presaleCouponDistribtionManager.queryByPreCouponId(preCouponId);
	}

	@Autowired
	private PresaleCouponExpirydateManager presaleCouponExpirydateManager;
	
	@Override
	public PresaleCouponExpirydate get(Integer preCouponId) {
		return presaleCouponExpirydateManager.get(preCouponId);
	}

}
